package uicgas.pump.commands;

import uicgas.communication.Communication;
import uicgas.globaldata.ActivationData;
import uicgas.globaldata.MessagePayload;
import uicgas.globaldata.States;
import uicgas.pump.PumpLogic;

/**
 * Active pump command
 * 
 * @author Hong Wang
 *
 */
public class ActivatePump extends AbstractRemoteCommand
{
	private ActivationData activationData = null;

	public ActivatePump(PumpLogic pumpLogic, Communication communication,
			MessagePayload payLoad)
	{
		super(pumpLogic, communication);
		this.activationData = (ActivationData) payLoad;
	}

	@Override
	public void executeRemoteCommand()
	{
		pumpLogic.activatePump(activationData != null ? activationData
				.getCustomerCard() : null);
		pumpLogic.changeState(States.ACTIVATED);

	}

}
